const TMAP_KEY = 'GCXBZ-VWCKQ-AZ55E-B7OBJ-QQNME-OJFKP'
//搜索周边
export const searchAroundApi = (keyword, boundary) => {
    return new Promise((resolve, reject) => {
        uni.request({
            url: `https://apis.map.qq.com/ws/place/v1/search?key=${TMAP_KEY}&keyword=${keyword}&boundary=${boundary}`,
            method: 'GET',
            success: (res) => {
                resolve(res.data)
            },
            fail: (err) => {
                reject(err)
            }
        })
    })
}

//根据经纬度获取省市区
export const getAreaByLngLatApi = (lng, lat) => {
    return new Promise((resolve, reject) => {
        uni.request({
            url: `https://apis.map.qq.com/ws/geocoder/v1/?key=${TMAP_KEY}&location=${lat},${lng}`,
            method: 'GET',
            success: (res) => {
                resolve(res.data)
            },
            fail: (err) => {
                reject(err)
            }
        })
    })
}
